package entity;

import java.util.ArrayList;
import java.util.List;

public class IpSocket {
	private List<String> listSock = new ArrayList<String>();
	static int currentTranslateIp = 0;
	static int currentStackOverFlowIp = 0;

	public IpSocket() {
		listSock.add("184.107.59.40");
		listSock.add("184.107.59.41");
		listSock.add("184.107.59.42");
		listSock.add("184.107.59.43");
		listSock.add("184.107.59.44");
		listSock.add("184.107.59.45");
		listSock.add("184.107.59.46");
		listSock.add("184.107.59.47");
	}

	public List<String> getListSocket() {
		if (listSock.size() > 0) {

		} else {
			listSock.add("184.107.59.40");
			listSock.add("184.107.59.41");
			listSock.add("184.107.59.42");
			listSock.add("184.107.59.43");
			listSock.add("184.107.59.44");
			listSock.add("184.107.59.45");
			listSock.add("184.107.59.46");
			listSock.add("184.107.59.47");
		}
		return listSock;
	}

	public String get() {
		if (currentTranslateIp == listSock.size()) {
			currentTranslateIp = 0;
		}
		String result = listSock.get(currentTranslateIp);
		currentTranslateIp++;
		return result;
	}
	
	public String getIp4StackOverFlow() {
		if (currentStackOverFlowIp == listSock.size()) {
			currentStackOverFlowIp = 0;
		}
		String result = listSock.get(currentStackOverFlowIp);
		currentStackOverFlowIp++;
		return result;
	}

}
